﻿Public Class frmChoisirOptions

    Private Sub frmChoisirOptions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each opt As clsOptions In options
            If Not frmDetailsVehicule.lstOptions.Items.Contains(opt.nom) Then
                lstOptions.Items.Add(opt.nom)
            End If
        Next
    End Sub

    Private Sub lstOptions_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstOptions.SelectedIndexChanged
        For Each opt As clsOptions In options
            If lstOptions.SelectedItem = opt.nom Then
                txtNom.Text = opt.nom
                txtDescription.Text = opt.description
            End If
        Next
    End Sub

    Private Sub btnAnnuler_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnnuler.Click
        Me.Close()
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If lstOptions.SelectedItems.Count = 1 Then
            frmDetailsVehicule.lstOptions.Items.Add(lstOptions.SelectedItem)
        End If
        Me.Close()
    End Sub

    Private Sub frmChoisirOptions_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        Me.Dispose()
    End Sub
End Class